{include file='common/head'}
<div style="overflow-x: hidden;width: 96%;margin: auto;padding-top: 1rem;height: 750px">
    <blockquote class="layui-elem-quote layui-text">
        <div class="layui-row">
            <div class="layui-col-md4">
                <div class="grid-demo grid-demo-bg1">
                    <div class="layui-col-md3">
                        <div class="grid-demo grid-demo-bg1">订单编号 ：</div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="grid-demo">{$info.order_num | default=''}</div>
                    </div>
                </div>
            </div>
            <div class="layui-col-md4">
                <div class="grid-demo">
                    <div class="layui-col-md3">
                        <div class="grid-demo grid-demo-bg1">订单状态 ：</div>
                    </div>
                    <div class="layui-col-md3">
                        {if($info.status == 1)}
                        <div class="grid-demo">已下单</div>
                        {/if}
                        {if($info.status == 2)}
                        <div class="grid-demo">处理中</div>
                        {/if}
                        {if($info.status == 3)}
                        <div class="grid-demo">已完成</div>
                        {/if}
                    </div>

                </div>
            </div>
            <div class="layui-col-md4">
                <div class="grid-demo grid-demo-bg1">

                    <div class="layui-col-md4">
                        <div class="grid-demo grid-demo-bg1">创建日期 ：</div>
                    </div>
                    <div class="layui-col-md8">
                        <div class="grid-demo">{$info.add_time | default=''}</div>
                    </div>

                </div>
            </div>
        </div>
    </blockquote>

    <blockquote class="layui-elem-quote layui-text">
    <div class="layui-card">
        <div class="layui-card-header">订单详情</div>
        <div class="layui-card-body">
           {if($info.code != 'gfcl' && $info.code != 'gfys')}
                <p> 分类名称  {$info.cate_name | default=''}</p>
                <p> 项目名称   {$info.project_name | default=''}</p>
                <p> 地址 {$info.province | default=''}{$info.city | default=''}{$info.area | default=''}{$info.address | default=''}</p>
            {/if}
            {if($info.code == 'gfcl' )}
                <p> 分类名称  {$info.cate_name | default=''}</p>
                <p> 地址 {$info.province | default=''}{$info.city | default=''}{$info.area | default=''}{$info.address | default=''}</p>
            {/if}

            {if($info.status > 1 )}
                <p> 接单公司  {$info.user_name | default=''}</p>
                <p> 接单价格  {$info.price | default=''}</p>
                <p> 接单时间  {$info.accept_time | default=''}</p>
            {/if}



            {if($info.code == 'gfys' )}
            <p> 分类名称    <span style="margin-left: 5px;">:</span>   {$info.cate_name | default=''}</p>
            <p> 固废分类    <span style="margin-left: 5px;">:</span>   {if($info.solid_type == 1)} 一般分类{/if}{if($info.solid_type == 2)}危险分类{/if}</p>
            <p> 固废状态    <span style="margin-left: 5px;">:</span>   {if($info.solid_status == 1)} 固体{/if}{if($info.solid_status == 2)}液体{/if}{if($info.solid_status == 3)}半固半液{/if}{if($info.solid_status == 4)}气体{/if}</p>
            <p> 固废单位    <span style="margin-left: 5px;">:</span>   {$info.solid_num | default=''} 吨</p>
            <p> 始发地     <span style="margin-left: 5px;">:</span>   {$info.send_address | default=''}</p>
            <p> 目的地     <span style="margin-left: 5px;">:</span>   {$info.end_address | default=''}</p>
            <p> 地址      <span style="margin-left: 5px;">:</span>    {$info.province | default=''}{$info.city | default=''}{$info.area | default=''}{$info.address | default=''}</p>
            <p> 固废描述    <span style="margin-left: 5px;">:</span>   {$info.desc | default=''}</p>
            {/if}
        </div>
    </div>

    {if($code)}
    <table class="layui-table">
        <colgroup>
            <col width="10">
            <col width="20">
            <col width="20">
        </colgroup>
        <thead>
        <tr>
            <th>分类名称 </th>
            <th>业务名称</th>
            <th>固废编码</th>
        </tr>
        </thead>
        <tbody>
        {foreach($code as $k =>$v)}
        <tr>
            <td>{$v.cate_class}</td>
            <td>{$v.resource}</td>
            <td>{$v.code}</td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {/if}

    </blockquote>


    <div class="layui-form" action="" method="post">
        <input type="hidden" id="id" value="{$info.id}">
        {if($info.status == 2)}
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">选择处置方(合作方)</label>
                <div class="layui-input-inline">
                    <select name="accept_company_id" lay-verify="required" lay-search="">
                        <option value="">直接选择或搜索选择</option>
                        {foreach($company as $k=>$v)}
                        <option value="{$v.id}">{$v.company_name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">项目价格</label>
                <div class="layui-input-inline">
                    <input type="number" name="price"  autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="demo1">提交</button>
            </div>
        </div>
        {/if}
    </div>


</div>
{include file='common/footer'}


<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#date'
        });
        laydate.render({
            elem: '#date1'
        });

        //创建一个编辑器
        var editIndex = layedit.build('demo');

        //自定义验证规则
        form.verify({
            pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,content: function(value){
                layedit.sync(editIndex);
            }
        });

        //监听指定开关
        form.on('switch(switchTest)', function(data){
            layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
                offset: '6px'
            });
            layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
        });



        //监听提交
        form.on('submit(demo1)', function(data){
            var id = $('#id').val();
            data.field['id'] = id;
            $.ajax({
                url: '{:url("Userorder/save_order")}',
                type: 'post',
                dataType: 'json',
                data: data.field,
                success: function (obj) {
                    if(obj.code==200){
                        parent.layer.msg(obj.msg, {icon: 6,time: 1000});
                        //当你在iframe页面关闭自身时
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index,data.field); //再执行关闭
                    }
                    if(obj.code==400){
                        layer.msg(obj.msg, {icon: 5,time: 1000});
                    }
                },
                error:function(data){
                    console.log(data);
                }
            });

        });


    });
</script>

</body>
</html>